<?php
//Define constants prepared to fetch data.
define('CONFIG',"../data/config.xml");
define('DSN',"sqlite:../data/db.sqlite");
define('DATAROOT','..\data');

//Load programmer-defined functions.
include_once('lib/Functions.php');

//Load classes.
require_once('lib/class_Parameter.php');
require_once('lib/class_String.php');
require_once('lib/class_Request.php');
require_once('lib/class_HTMLDocument.php');
require_once('lib/class_HTMLElement.php');
require_once('lib/class_Table.php');
require_once('lib/class_Data.php');
require_once('lib/class_Shundate.php');

//Start Session.
session_start();
//Create Request Object and Data Object.
$request=new Request();
$data=new Data(DSN);
//$parameter=new Parameter(CONFIG);

//Check Request's Privilege.
if(!$request->access)
	header("Location: index.php?m=System&f=login");

//Handle the GET Request.
if($request->method=='GET'){
	$dir=str_replace('_','/',$request->module);
	$file=$dir."/data.php";
	include($file);

	$view='chrome';
	include("$view.php");
}
//Handle the POST Request.
if($request->method=='POST'){
	$dir=str_replace('_','/',$request->module);
	$file=$dir."/model.php";
	include($file);
}
?>